require('../css/goodsList.less');
// 好物榜
window.onload = function () {
  let user = JSON.parse(localStorage.getItem('user'));
  let bx = document.querySelector('.banxing');
  let id = user.id;

  // get 
  http.get('http://23.224.181.169:8098/perfectGoods/list?id=' + id, function (res) {
    console.log(res);
    res.data.reverse()
    // 循环遍历生成
    for (let a = 0; a < res.data.length; a++) {
      let div = document.createElement('div'); //创建一个div
      div.className = 'commodiBox'
      div.innerHTML = `
                <div class="commoBox ">
                <div class="px ">${res.data[a].id}</div>
                <div class="imgBox ">
                    <img src="http://23.224.181.169:8098${res.data[a].img}" alt=" ">
                </div>
                <div class="TextBox ">
                    <div class="titleBox ">${res.data[a].title}</div>
                    <div class="desc_textBox ">${res.data[a].desc_text}</div>
                    <div class="fenlei ">
                        <div class="fenleiTop ">TOP</div>
                        <div class="fenleititle ">${res.data[a].type}</div>
                    </div>
                    <div class="moneyBox ">
                        <div><span class="current_price ">￥<span>${res.data[a].current_price}</span>起</span> <span>￥<span class="old_price ">${res.data[a].old_price}</span></span>
                        </div>
                    </div>
                </div>
            </div>
             `
      bx.appendChild(div);
    }
  })

}